#include "client.h"

#include <iostream>
#include <cstdlib>
#include <vector>
#include <thread>

#include <sys/socket.h>
#include <netinet/in.h>

int main(int argc, char* argv[])
{
  // check input parameter
  std::cout << "ZJU computer network LAB7: 3180104829 王家蔚" << std::endl;
  if(argc < 2 or argv[1] == NULL)
  {
    std::cerr << "Please enter the client's hostname legally!" << std::endl;
    exit(0);
    return -1;
  }

  std::string cname(argv[1]);
  Client clt(cname);
  clt.help();
  std::thread cmd(cmd_handler, std::ref(clt));
  std::thread rev(rcv_handler, std::ref(clt));

  cmd.join();
  rev.join();
  return 0;
}
